#ifndef GUI_TEXTBOX_H
#define GUI_TEXTBOX_H

#include <string>
#include <vector>
#include <utility>

//#include "BaseElement.h"
#include "gdn/GDN.h"

#include "utilities/Rectangle.h"

namespace gui
{
	class TextBox //: BaseElement
	{
		public:
			typedef std::vector< std::pair< gdn::Rectanglef, std::string > > CharacterMap;

			TextBox();
			TextBox( const gdn::Vector2f& thePos, const std::string& theDefaultText, unsigned int theMaxLength,
			         gdn::Image& theKeyboardImage, gdn::Image& theKeyboardImageShift, gdn::Font& theFont, const gdn::Color& theTextColor, unsigned int theCharSize,
			         const gdn::Vector2f& theTextPos, const CharacterMap& theCharacters, const CharacterMap& theCharactersShift );

			virtual int  Process( const gdn::Event& event );
			virtual void Draw( gdn::Window& window );
			virtual void Draw( gdn::RenderImage& renderImage );

			std::string GetText() const;

		protected:
			gdn::Vector2f pos;
			gdn::Vector2f mousePos;

			std::string defaultText;
			std::string text;
			unsigned int maxLength;
			bool shift;

			gdn::Image* keyboardImage;
			gdn::Image* keyboardImageShift;

			gdn::Font* font;
			gdn::Color textColor;
			unsigned int charSize;

			gdn::Vector2f textPos;

			CharacterMap characters;
			CharacterMap charactersShift;

			gdn::Sprite keyboard;
			gdn::Text textDisplay;

			virtual void SetText( const std::string& theText );
			virtual void AppendText( const std::string& theText );
			virtual void DeleteEndCharacter();

			virtual bool AddCorrespondingCharacter( const CharacterMap& characterMap, gdn::Vector2f mousePos );

			void ToggleShift();
	};
}

#endif // GUI_TEXTBOX_H

